import time

from classify.bayes.continuity.gaussian_nb import GaussianNB
from utils.DataUtil import DataUtil

if __name__ == '__main__':

    dataset = "mushroom"
    path = "/home/xiefeihong/PycharmProjects/SimpleMachineLearning/static/classify/{}.txt".format(dataset)
    _x, _y = DataUtil.get_dataset(dataset, path)

    learning_time = time.time()
    nb = GaussianNB()
    nb.fit(_x, _y)
    estimation_time = time.time()
    nb.evaluate(_x, _y)
    estimation_time = time.time() - estimation_time

    print(
        "Model builiding  : {:12.6} s\n"
        "Estimation     : {:12.6} s\n"
        "Total         : {:12.6} s".format(
            learning_time, estimation_time,
            learning_time + estimation_time
        )
    )